package com.easyj.base.common.ajax;

import java.io.Serializable;


public class Result implements Serializable{
	
	public static final String DEFAULT_SUCCESS_MESSAGE = "请求成功";

    public static final String DEFAULT_ERROR_MESSAGE = "服务异常";

   

	public static final int SUCCESS_CODE = 200;

    public static final int SERVICE_ERROR_CODE = 500;
	
	private static final long serialVersionUID = 1L;
	
	private int code;
	private String message;
	private Object data;
	
	

	public Result(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
	
	public static Result Success() {
	    return new Result(SUCCESS_CODE,null,null);
    }
	
    public static Result Success(Object data) {
	        return new Result(SUCCESS_CODE,null,data);
    }
	 
    public static Result Error(String message) {
        return new Result(SERVICE_ERROR_CODE,message,null);
    }
    /**
     * 
     * @param errorCode  错误代码，不能为成功代码200
     * @param message
     * @return
     */
    public static Result Error(int errorCode ,String message) {
        return new Result(errorCode,message,null);
    }
    
	public int getCode() {
			return code;
	}
		

	public String getMessage() {
		return message;
	}

	

	public Object getData() {
		return data;
	}

	
}
